<%@ page contentType="text/html; charset=utf-8" language="java"%>
<%@ include file="/jsp/common/index.jsp"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
    <head>
    <title>权限设置</title>
		<%@ include file="/jsp/common/js.jsp"%>
		<%@ include file="/jsp/common/css.jsp"%>
		<base target="_self">
		<script language="javascript">
		<!--
		   function dataInsertOrUpdate()
		   {
		   
		       g("form").submit();
		   }
		   function chargState(i){
				if(g("state"+i).checked){
					//g("functionId"+i).checked="checked";
					g("moduleRef"+i+".state").value="0";
				}else{
					if(g("functionId"+i).checked){
						g("moduleRef"+i+".state").value="2";
					}else{
						g("moduleRef"+i+".state").value="1";
					}
				}
		   }
		-->
		</script>
	</head>

	<body class="cbody">
		<%@ include file="/jsp/page/pagehead.jsp"%>
		<br/>
		<s:form id="form"  action="saveFunction" theme="simple">  
		<s:hidden name="vo.id" id="vo.id"></s:hidden>
		<table width="90%" border="0" cellpadding="0" cellspacing="0" class="inputarea" align="center">
		<thead>
		    <tr class="detailrow">
		       <td class="tleft" colspan="3">&nbsp;权限设置</td>
		    </tr>
		</thead>
		<s:set name="i" id="i" value="0"></s:set>
			<s:iterator value="moduleList" status="st" id="mm">
		   <tr class="detailrow">
				<td class="tright" width="30%" valign="top">
					<input type="hidden" id="moduleList[<s:property value="#st.index"/>].id" name="moduleList[<s:property value="#st.index"/>].id" value="<s:property value="id"/>"/>
					<s:property value="name"/>(<s:property value="beanId"/>)
				</td>
				<td valign="top">
					<table width="90%" border="0" cellpadding="0" cellspacing="0">
						<s:iterator value="functions" status="st1"  id="ref">
						<tr>
							<td>
								&nbsp;<input type="checkbox" onclick="chargState(<s:property value="#i"/>);" <s:if test='#ref.state == "2" '>checked="checked"</s:if> id="functionId<s:property value="#i"/>" name="functionId<s:property value="#i"/>" >
								&nbsp;<s:property value="#ref.name"/>
							</td>
							<td>
								&nbsp;<input type="checkbox" onclick="chargState(<s:property value="#i"/>);" <s:if test='#ref.state == "0" '>checked="checked"</s:if> id="state<s:property value="#i"/>" name="state<s:property value="#i"/>">禁用
							</td>
							<input type="hidden" id="moduleRef<s:property value="#i"/>.id" name="moduleList[<s:property value="#st.index"/>].functions[<s:property value="#st1.index"/>].id" value="<s:property value="#ref.id"/>"/>
							<input type="hidden" id="moduleRef<s:property value="#i"/>.state" name="moduleList[<s:property value="#st.index"/>].functions[<s:property value="#st1.index"/>].state" value="<s:property value="#ref.state"/>"/>
							<input type="hidden" id="moduleRef<s:property value="#i"/>.limitIndex" name="moduleList[<s:property value="#st.index"/>].functions[<s:property value="#st1.index"/>].limitIndex" value="<s:property value="#ref.limitIndex"/>"/>
						</tr>
						<s:set name="i" id="i" value="#i+1"></s:set>
						</s:iterator>
					</table>
				</td>
			</tr>
			</s:iterator>

			<tr>
			    <td>
			       &nbsp;
			    </td>
				<td class="tcenter">
					<input type="button" class="wbt" value="保存" id="UpdateButton" onclick="dataInsertOrUpdate();"/>
					&nbsp;&nbsp;
					<input type="button" class="wbt" value="列表" id="listButton" onclick="window.location='beforeSelect.htm';"/>
				</td>
				<td>
				   &nbsp;
				</td>
			</tr>

            <tr>
				<td cospan="3" class="tcenter">
					&nbsp;
				</td>
			</tr>
 
		</table>
        </s:form>



		<%@ include file="/jsp/page/foot.jsp"%>
	</body>
</html>

